
function getDate() {
    //实例化对象
    let date = new Date();//格林威治时间
    let year = date.getFullYear();
    let month = date.getMonth() + 1;
    let day = date.getDay();
    let hour = date.getHours();
    let minute = date.getMinutes();
    let second = date.getSeconds();

    month=month>9?month:'0'+month;
    day=day>9?day:'0'+day;
    console.log(month,day);
    console.log(`${year}-${month}-${day} ${hour}:${minute}:${second}`);
}
getDate()